Skip to content

feat: agent pipeline narration, run traces, verification structure fixes#20

Merged
smilebank7 merged 2 commits into
mainfrom
feat/agent-observability-pipeline
Jun 11, 2026
Merged

feat: agent pipeline narration, run traces, verification structure fixes#20
smilebank7 merged 2 commits into
mainfrom
feat/agent-observability-pipeline

Conversation

@smilebank7

@smilebank7 smilebank7 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

무엇이 바뀌나

검증 화면이 "단계명 + 통과/실패"만 보여주던 것을, 각 에이전트가 실제로 한 일의 중계로 바꿉니다. 동시에 에이전트 서버에 관측성(JSONL 트레이스)을 깔고, D-5 멀티에이전트 구조 리뷰에서 확인된 결함 4건을 수리합니다.

UX — 스텝바가 서사를 말함

  • 게이트 evidence를 단계별 한국어 한 줄 요약으로 변환해 step 이벤트에 실어 보냄 (wire-adapter.ts 개편)
    • 예: 후보 생성 (gpt-5.5(xhigh)) · Critic 1라운드 · 지적 1건 반영 · 33.7초, SymPy 검산 일치 (해: -1, 4) · 1.5초
  • 죽어 있던 preview 이벤트를 BE가 emit — 3단계 직후 후보 문제가 화면에 뜸 (FE 렌더 경로는 이미 존재했음)
  • 정직한 3-상태: unverified가 더 이상 ✓통과로 위장하지 않음 (△ "기호 검증 불가 — 재풀이로 확인"), intent LLM 폴백은 "(시드 의도로 대체)" 표기
  • attempt 이벤트: 재시도 시 "시도 n/m + 사유" 배너 + 3~6단계 리셋
  • runs 이벤트: 병렬 생성 런 집계 (문항 n/m 완료) + 첫 런 종료 후 대기 구간 안내

DX — 로그 0줄 → run 단위 트레이스

  • TRACE_DIR(기본 ./runs)에 run별 JSONL: 요청 전문 + 모든 ProgressEvent(게이트 evidence, Critic/가드 힌트 전문 포함)
  • llm.jsonl: LanguageModel 미들웨어로 모든 LLM 호출의 지연/토큰/finish_reason 계측 (에이전트 코드 무수정)
  • 서버 stdout에 run별 내레이션 한 줄 로그

구조 수정 (D-5 검토 결과)

결함 수리
"독립" 재풀이가 생성기와 같은 gpt-5.5 인스턴스 공유 SOLVER_MODEL=gpt-5.4 분리 (llm.jsonl에서 작동 확인)
generate 실패 시 도달불가 dead catch → 워크플로우 통째 폭사 failed 게이트 + 4~6 skipped로 강등, 재시도 정책 경유, 전부 실패 시 last-resort 템플릿 or 명확한 에러
Refiner가 generator 재호출 위장 (자기 프롬프트/모델 미사용) prompts/refiner.md(v0.2.0, 변경 범위 제한)를 쓰는 진짜 수선 에이전트로 교체
Critic 지적 내용이 어디에도 안 남음 critic_rounds/critic_hints_total을 evidence에 보존 → summary/트레이스로 노출
4·5단계 불필요한 순차 실행 sympy_verifyre_solve 병렬화
driver 런 에러 시 다른 런 성공해도 에러 노출 driver 에러 버퍼링 — 형제 런이 문항을 만들면 result 우선

Wire 계약 변경 (FE+BE 동시 수정)

step.statusunverified 추가, 성공 시에도 summary 제공, attempt/runs 이벤트 신설. docs/specs/architecture.md D-6과 packages/web/README.md §SSE Consumption 갱신.

검증

  • ✅ 에이전트 단위테스트 247/247 (신규: refiner-agent, verification-workflow-generate-failure, wire 서사/preview 케이스)
  • ✅ agent + web tsc --noEmit 클린
  • 라이브 스모크: 실행 중 dev 스택에 실요청 — 서사 summary/preview/4·5 동시 시작/runs 1/2→2/2/트레이스 파일/gpt-5.4 (solver) 호출 전부 관측됨

후속 거리 (이 PR 범위 밖)

  • 토픽 별칭 하드코딩 테이블(objective-mapping.ts, rag-search.ts)의 strategy 데이터 파일 이동
  • JSONL 트레이스 → OTEL 허브 연동
  • verify 화면 브라우저 실관찰 QA

🤖 Generated with Claude Code


Summary by cubic

Adds narrated step summaries, early candidate preview, attempt/runs SSE events, and per‑run traces so reviewers can see what happened in each pipeline step. Also separates the solver model, hardens retries on generation failure, and replaces the refiner with a real repair agent.

  • New Features

    • Step bar shows short summaries from gate evidence (refs, objective code, critic rounds/hints, SymPy solutions, re‑solve confidence, durations). unverified is now shown (△).
    • Sends preview right after generate so the first candidate appears earlier.
    • New SSE: attempt (retries with reason; resets steps 3–6) and runs (parallel run progress n/m).
    • Run‑level JSONL traces under TRACE_DIR with all ProgressEvent evidence; llm.jsonl logs latency/tokens via a LanguageModel middleware; concise stdout narration per run.
    • FE updated to consume unverified/attempt/runs/preview and show notices; docs updated (docs/specs/architecture.md, packages/web/README.md). Integration test asserts parallel 4/5 and preview formatting.
  • Bug Fixes

    • Independent re‑solve uses a separate model via SOLVER_MODEL (default gpt-5.4) instead of sharing the generator checkpoint.
    • Generation failures degrade to a failed gate; steps 4–6 are skipped and the retry policy runs. If all attempts fail, emit generation_failed; with last-resort, fall back to the deterministic template.
    • Replaced the refiner with a real agent using prompts/refiner.md (bounded, in‑place repair with one schema‑retry path).
    • Records critic_rounds and total hints in gate evidence; shown in summaries and traces.
    • sympy_verify and re_solve run in parallel; driver errors are buffered so sibling runs can still return results.

Written for commit dacde49. Summary will update on new commits.

Review in cubic

UX — the 6-step bar now tells what actually happened instead of bare 통과/실패:
- Step summaries built from gate evidence (refs count, objective code, critic
  rounds/hints applied, SymPy solutions, re-solve answer + confidence, durations)
- Emit the long-dead `preview` SSE event after generate (FE stage already existed)
- Honest 3-state: `unverified` no longer masquerades as 통과 (△ badge), intent
  LLM fallback is labeled, new `attempt` event resets steps 3-6 with reason,
  new `runs` event surfaces parallel generation progress (n/m)

DX — zero-logging agent now leaves a trail:
- Per-run JSONL traces (request + every ProgressEvent incl. full gate evidence
  and critic/guard hints) under TRACE_DIR (default ./runs), plus llm.jsonl with
  per-call latency/tokens via a LanguageModel middleware; stdout narration per run

Structure — fixes for flaws found in the D-5 review:
- Split SOLVER_MODEL (gpt-5.4) so independent re-solve no longer shares the
  generator checkpoint (was sharing one gpt-5.5 instance, defeating D-5)
- Generation failure degrades to a failed gate + skipped 4-6 and goes through
  the retry policy instead of killing the whole run (dead catch repaired)
- RefinerAgent is now a real agent using prompts/refiner.md (repair-in-place,
  bounded change scope) instead of a disguised generator re-call
- Critic critiques are preserved in gate evidence (critic_rounds, hints)
- sympy_verify and re_solve run concurrently; driver errors are buffered so
  sibling runs can still deliver a result

Wire contract (FE+BE updated together): step.status gains `unverified`,
step.summary on success, new attempt/runs events; docs updated (D-6, web README).

Tests: 247 passed (3 new test files), agent+web typecheck clean, live smoke
verified against the running dev stack (preview/summaries/runs/traces observed).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@smilebank7 smilebank7 enabled auto-merge (squash) June 11, 2026 03:56
The SSE step sequence assertion encoded the old sequential contract;
sympy_verify and re_solve now start together. Assert (index, status)
pairs to document the parallel contract, and assert the preview event
carries the formatLatex-formatted candidate text.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@smilebank7 smilebank7 merged commit 855f799 into main Jun 11, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant